package com.mmall.common;

import com.google.common.collect.Sets;

import java.util.Set;

/**
 * Created by Administrator on 2017/12/7.
 */
public class Const {
    public static final String CURRENT_USER = "CURRENT_USER";

    //将常量进行分组
    public interface Role {
        int ROLE_CUSTOMER = 0;
        int ROLE_ADMIN = 1;
    }

    public interface productListOrderBy {
        //使用set而不是list，是因为set的contains方法的时间复杂度为o(1) 而list的contain方法时间复杂度为o（n）
        Set<String> PRICE_ASE_DSE = Sets.newHashSet("price_desc", "price_asc");
    }

    public interface Cart {
        int CHECKED = 1;//购物车中选中状态
        int UN_CHECKED = 0;//购物车中未选中状态

        String LIMIT_NUM_FAIL = "LIMIT_NUM_FAIL";
        String LIMIT_NUM_SUCCESS = "LIMIT_NUM_SUCCESS";// 限制成功   库存》=购物车中的数量
    }

    public static final String EMAIL = "EMAIL";
    public static final String USER_NAME = "USER_NAME";

    public enum ProductStatusEnum {
        ON_SALE(1, "在线");
        private String value;
        private int code;

        public String getValue() {
            return value;
        }

        public int getCode() {
            return code;
        }

        ProductStatusEnum(int code, String value) {
            this.value = value;
            this.code = code;
        }
    }

    public enum OrderStatusEnum {
        CANCELED(0, "已取消"),
        NO_PAY(10, "未支付"),
        PAID(20, "已付款"),
        SHIPPED(40, "已发货"),
        ORDER_SUCCESS(50, "订单完成"),
        ORDER_CLOSE(60, "订单关闭");

        OrderStatusEnum(int code, String value) {
            this.code = code;
            this.value = value;
        }

        private int code;
        private String value;

        public int getCode() {
            return code;
        }

        public String getValue() {
            return value;
        }
    }


    public interface AlipayCallBack {
        //  交易创建，等待买家付款
        String TRADE_STATUS_WAIT_BUYER_PAY = "WAIT_BUYER_PAY";
        // 	未付款交易超时关闭，或支付完成后全额退款
        String TRADE_STATUS_TRADE_CLOSED = "TRADE_CLOSED";
        // 	交易支付成功
        String TRADE_STATUS_TRADE_SUCCESS = "TRADE_SUCCESS";
        // 	交易结束，不可退款
        String TRADE_STATUS_TRADE_FINISHED = "TRADE_FINISHED";

        String RESPONSE_SUCCESS = "success";
        String RESPONSE_FAILED = "failed";
    }

    public enum PayPlatFormEnum {
        ALIPAY(1,"支付宝")
        ;

        PayPlatFormEnum(int code, String value) {
            this.code = code;
            this.value = value;
        }

        private int code;
        private String value;

        public int getCode() {
            return code;
        }

        public String getValue() {
            return value;
        }
    }
}
